package com.wangyu.springsecuritydemo.entity.primary;

import com.wangyu.springsecuritydemo.entity.BaseEntity;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

/**
 * @Author wangyu
 * @Date 2019/2/18 16:00
 * @Version 1.0
 */
@Entity
@Table(name = "sys_user")
public class UserEntity extends BaseEntity {

  /**
   * serialVersionUID
   */
  private static final long serialVersionUID = 5494607584383665640L;

  /**
   * 用户名
   */
  @Column(name = "username", length = 32)
  private String userName;

  /**
   * 密码
   */
  @Column(name = "password", length = 64)
  private String password;

  /**
   * 真实姓名
   */
  @Column(name = "true_name", length = 64)
  private String trueName;

  @ManyToMany(fetch = FetchType.LAZY, mappedBy = "users")
  private Set<RoleEntity> roles;

  public String getUserName() {
    return userName;
  }

  public void setUserName(String userName) {
    this.userName = userName;
  }

  public String getPassword() {
    return password;
  }

  public void setPassword(String password) {
    this.password = password;
  }

  public String getTrueName() {
    return trueName;
  }

  public void setTrueName(String trueName) {
    this.trueName = trueName;
  }

  public Set<RoleEntity> getRoles() {
    return roles;
  }

  public void setRoles(Set<RoleEntity> roles) {
    this.roles = roles;
  }
}
